package com.gomeplus.diamond;

import com.taobao.diamond.manager.DiamondManager;
import com.taobao.diamond.manager.ManagerListener;
import com.taobao.diamond.manager.impl.DefaultDiamondManager;

import java.util.concurrent.Executor;

public class DiamondTestClient {
    public static DiamondManager manager;

    public static void main(String[] str) {
//	        initDiamondManager();
        DiamondConfig.init("gome.finance.cashier.pay-admin");
        System.out.println(DiamondConfig.getString("test"));
    }

    private static void initDiamondManager() {
        manager = new DefaultDiamondManager("group_test", "dataId_test", new ManagerListener() {
            @Override
            public void receiveConfigInfo(String configInfo) {
                restart();
            }

            @Override
            public Executor getExecutor() {
                return null;
            }
        }, "10.126.53.168,10.126.53.169");
        restart();
    }

    private static void restart() {
        String availableConfigureInfomation = manager.getAvailableConfigureInfomation(5000);
        System.out.println("availableConfigureInfomation=" + availableConfigureInfomation);
    }
}
